<template>
  <view class="bar"></view>

  <view>

    <view style="display: flex;flex-direction: column;margin: 0 40rpx">
      <text style="word-wrap: break-word;font-weight: 600">送至
        &nbsp;{{ address.province + address.city + address.country + address.detail }}
      </text>
      <text style="margin-top: 15rpx">{{ address.name }}&nbsp;{{ address.phone }}</text>
    </view>
    <u-line style="margin-top: 20rpx"/>
    <goodsItem v-for="(item,index) in info.orderItems" :item="item" :key="item.id"></goodsItem>

    <view>
      <view class="item">
        <view>总价：</view>
        <text>￥{{ info.orderPrice }}</text>
      </view>
      <u-line></u-line>
    </view>

    <view class="item">
      <view>实付款：</view>
      <text style="color: red;font-size: 35rpx">￥{{ info.orderPrice }}</text>
    </view>
    <u-line></u-line>

    <view class="item">
      <view>创建时间：</view>
      <text>{{ info.createTime }}</text>
    </view>
    <u-line></u-line>

    <view v-if="info.playTime" class="item">
      <view>付款时间：</view>
      <text>{{ info.playTime }}</text>
    </view>
    <u-line></u-line>

    <view v-if="info.deliveryTime" class="item">
      <view>发货时间：</view>
      <text>{{ info.deliveryTime }}</text>
    </view>
    <u-line></u-line>
  </view>
</template>

<script setup lang="ts">
import {reqGetByOrderIdInfo} from "@/api/order";
import {onLoad} from "@dcloudio/uni-app";
import {ref} from "vue";

const info = ref({})
const address = ref({})
onLoad(async (options: any) => {
  await reqGetByOrderIdInfo(options.id).then((res: any) => {
    if (res.code == 200) {
      info.value = res.data
      console.log(info.value)
      address.value = JSON.parse(res.data.address)
    }
  })
})

</script>


<style scoped lang="scss">
.item {
  display: flex;
  justify-content: space-between;
  padding: 20rpx;
}
</style>
